package days29.Title101;

class Solution {
    public boolean isSymmetric(TreeNode root) {
        return isSymmetric2(root.left,root.right);
    }
    public boolean isSymmetric2(TreeNode left,TreeNode right){
        if (left==null&&right==null)
            return true;
        if (left!=null&&right!=null){
            if (left.val!= right.val)
                return false;
            if (isSymmetric2(left.right,right.left)){
                return isSymmetric2(left.left, right.right);
            }
        }
        return false;
    }
}